<?php
class controller_product extends base_module
{
    protected $Product;

    public function __construct()
    {
        $this->Product = RpcClient::instance("Product");
        parent::__construct();
    }
    // 商品分类
    public function productcategory()
    {
        $data = $this->Product->getProductCategoryList($this->paras);
        if($data['state']==200) {
            $result = $data['data'];
            echo json_encode($result);
        }else{
            echo json_encode($this->result);
        }
    }
    // 兑换首页轮播
    public function defaultproductbanner()
    {
        $result = $this->Product->getProductBanner($this->paras);
        echo json_encode($result);
    }
    // 首页商品
    public function defaultproducts()
    {
        $result = $this->Product->getDefaultProductList($this->paras);
        echo json_encode($result);
    }
    // 商品详情
    public function productitem()
    {
        $result = $this->Product->getProductForCode($this->paras);
        echo json_encode($result);
    }
    //商品兑换支付
    public function exchangepay()
    {
        $data = $this->Product->exchangeOrderPay($this->paras);
        if($data['state']==200) {
            $result = $data['data'];
            echo json_encode($result);
        }else{
            echo json_encode($this->result);
        }
    }

}